package src.view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.util.Collection;

import src.event.EventHandler;
import src.event.EventListener;
import src.event.events.TechUpdateEvent;
import src.model.gameObject.PlayerGameObject;
import src.model.gameWorld.GameDataObject;
import src.model.gameWorld.Player;
import src.view.ViewHandler.DisplayType;
import src.view.ViewHandler.ImageType;

/**
 * <b>Overview</b>
 * The TechnologyViewport shows all of a player's acquired technologies and allows the player to choose a branch to research.
 *
 * <b>Responsibilities</b>
 * Display all of the current player's acquired technologies and allow the player to choose a branch to research.
 *
 * <b>Collaborators</b>
 * Drawable - Subcontractor: The Drawable object displays this viewport to the screen as instructed.
 *
 * <b>Implementor</b> - Bruce
 * <b>Tester</b> - Tim
 *
 * @author Bruce
 */
public class TechnologyViewport extends Viewport implements EventListener<TechUpdateEvent>
{
	public TechnologyViewport(ViewHandler vh, Drawable canvas)
	{
		super(vh, canvas, DisplayType.TECHNOLOGY);
		EventHandler<TechUpdateEvent> handler = new EventHandler<TechUpdateEvent>();
		ViewEventHandler.setTechListener(handler);
		handler.regesterListener(this);
	}

	/* (non-Javadoc)
	 * @see src.event.EventListener#eventCallback(src.event.Event)
	 */
	public boolean eventCallback(TechUpdateEvent e)
	{
		// TODO Stub
		return false;
	}

	@Override
	protected void draw()
	{
		// Background
		BufferedImage image = getImage(ImageType.PAPER);
		AffineTransform at = new AffineTransform();
		at.scale((double)getWidth() / (double)image.getWidth(), (double)getHeight() / (double)image.getHeight());
		getCanvas().drawImage(image, at, null);

		drawString("Technology Tree", 100, 100, Color.BLACK, Color.WHITE, 56);
	}

	@Override
	protected Dimension getResizeDimension()
	{
		return getCanvasDimensions();
	}

	@Override
	protected Point2D getResizePoint()
	{
		return Point2D.origin();
	}
}